package com.wlanauth.web.core;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;

public class JsonResultConfig {
	
	private String[] excludeProperties;
	private String[] includeProperties;
	
	private boolean ignoreHierarchy = false;
	private boolean excludeNullProperties = false;
	
	
	public String[] getExcludeProperties() {
		return excludeProperties;
	}
	public void setExcludeProperties(String[] excludeProperties) {
		this.excludeProperties = excludeProperties;
	}
	public String[] getIncludeProperties() {
		return includeProperties;
	}
	public void setIncludeProperties(String[] includeProperties) {
		this.includeProperties = includeProperties;
	}
	public boolean isIgnoreHierarchy() {
		return ignoreHierarchy;
	}
	public void setIgnoreHierarchy(boolean ignoreHierarchy) {
		this.ignoreHierarchy = ignoreHierarchy;
	}
	public boolean isExcludeNullProperties() {
		return excludeNullProperties;
	}
	public void setExcludeNullProperties(boolean excludeNullProperties) {
		this.excludeNullProperties = excludeNullProperties;
	}
	
	public List<Pattern> getIncludePropertyPatterns(){
		if(this.includeProperties == null) return null;
		List<Pattern> patterns = new ArrayList<Pattern>();
		for(String str :includeProperties){
			patterns.add(Pattern.compile(str));
		}
		return patterns;
	}
	public List<Pattern> getExcludePropertyPatterns(){
		if(this.excludeProperties == null) return null;
		List<Pattern> patterns = new ArrayList<Pattern>();
		for(String str :excludeProperties){
			patterns.add(Pattern.compile(str));
		}
		return patterns;
	}
}
